<!--账户管理通知查询页面-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('detials', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <!-- 明细弹出框 -->
    <manage-details ref="manageDetailsDialog" :dictMap="dictMap" :formData.sync="formData"></manage-details>
  </div>
</template>
<script>
import { apiUrlConfig, detail } from "@/api/cnaps/saps/clearAcctInfoQuery/clear_manage_query.js";
import ManageDetails from "./components/manageDetails";
import { listPageMixin } from "@/libs/listPageMixin";

export default {
  name: "clearManageQuery",
  mixins: [listPageMixin],
  components: {
    ManageDetails,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      total: 0,
      dataList: [],
      //数据字典
      searchFormDictList: [
        "NTFCTN_TYPE_TC",
        "DRCTCODE",
        "PKG_STATUS",
        "PROCESSSTATUS",
        "SYSTEMCODE",
        "PARTYCATEGORYCODE",
        "ACCOUNTSTATUSCODE",
        "D_CTLSET_TYPE",
        "C_CTLSET_TYPE",
        "SWITCHTYPECODE",
        "CURCD",
        "PLUSMINUSTYPECODE",
        "PLDG_FLAG",
        "EFF_FLAG",
      ],
      //  明细弹框数据
      // form表单字段
      formData: {
        ntfctnType: "",
        id: "",
        pkgId: "",
        workDate: "",
        drct: "",
        sysCode: "",
        directSender: "",
        directSenderName: "",
        directRecver: "",
        directRecverName: "",
        tc00Brno: "",
        tc00OrgClass: "",
        tc00EffDate: "",
        tc00ActStatus: "",
        tc00RstrctAmtLwrLmt: "",
        tc00Balance: "",
        tc01StBrno: "",
        tc01StActName: "",
        overCurcd: "",
        tc01OverdrftLmt: "",
        tc01RstrctAmtLwrLmt: "",
        tc01DbtRstrctSetng: "",
        tc01CdtRstrctSetng: "",
        tc02EffDate: "",
        tc02SwitchType: "",
        tc03WatchBrno: "",
        stBrName: "",
        tc03SwitchType: "",
        warnCurcd: "",
        tc03WarnValue: "",
        tc03WarnPmFlag: "",
        tc04StBrno: "",
        tc04PldgFincgId: "",
        startingPtCurcd: "",
        tc04StartingPt: "",
        tc05DStBrno: "",
        tc05CStBrno: "",
        tc05ProtoNum: "",
        tc05EffFlag: "",
        hvpspayacc: "",
        hvpspayamount: "",
        bepspayacc: "",
        bepspayamount: "",
        settleMentacc: "",
        settlementAmount: "",
      },
      showSearch: true,
      // 查询参数
      queryParams: {
        id2: "",
        workdate: "",
        workdate2: "",
        vdate1: "",
        vdate2: "",
        ntfctnType: "",
      },
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        { label: `交易流水号`, prop: "id", width: "170", sortable: false },
        {
          label: `系统编号`,
          prop: "sysCode",
          width: "160",
          sortable: false,
          dictCode: "SYSTEMCODE",
        },
        {
          label: `CPG日期`,
          prop: "vdate",
          sortable: false,
          type: "date",
        },
        {
          label: `工作日期`,
          prop: "workDate",
          sortable: false,
          type: "date",
        },
        {
          label: `发起参与机构号`,
          prop: "directSender",
          width: "170",
          sortable: false,
        },
        {
          label: `通知类型`,
          prop: "ntfctnType",
          width: "180",
          dictCode: "NTFCTN_TYPE_TC",
          sortable: false,
        },
        {
          label: `报文接收时间`,
          prop: "rcvTime",
          sortable: false,
          type: "date",
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "input",
        prop: "id2",
        defaultAttr: {
          label: "交易流水号",
          placeholder: "请输入交易流水号",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate",
          endTimeName: "workdate2",
        },
        defaultAttr: {
          label: "CPG日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "dict",
        prop: "ntfctnType",
        dict: "NTFCTN_TYPE_TC",
        defaultAttr: {
          label: "通知类型",
          placeholder: "请选择",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "vdate1",
          endTimeName: "vdate2",
        },
        defaultAttr: {
          label: "工作日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
    ];
  },
  methods: {
    editComplete(state) {
      if (state == true) {
      }
    },
    handleAction(type, row = {}) {
      switch (type) {
        case "detials":
          // 明细信息
          detail({ id: row.id, ntfctnType: row.ntfctnType }).then((res) => {
            this.formData = _.clone(res.result);
            if (res.result.bepspayAmount) {
              this.$set(this.formData, "bepspayamount", res.result.bepspayAmount);
              this.$set(this.formData, "bepspayacc", res.result.bepspayAcc);
              this.$set(this.formData, "hvpspayacc", res.result.hvpsPayAcc);
              this.$set(this.formData, "hvpspayamount", res.result.hvpspayAmount);
              this.$set(this.formData, "settleMentacc", res.result.settleMentAcc);
              this.$set(this.formData, "settlementAmount", res.result.settleMentAmount);
            }

            this.$refs.manageDetailsDialog.show();
          });

          break;
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
